package pl.nazaweb.samplesandtutorials;

import java.util.ArrayList;
import java.util.List;

import pl.nazaweb.samplesandtutorials.adapters.ImageAdapter;

import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.widget.GridView;

public class GridViewWithImageAdapterExample extends Activity {

	GridView gridView;
	
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_grid_view_with_image_adapter_example);
        gridView = (GridView)findViewById(R.id.gridviewexample);
        initGridViewAdapter();
    }
    
    private void initGridViewAdapter(){
    	List<Integer> images = new ArrayList<Integer>();
    	images.add(R.drawable.db1);
    	images.add(R.drawable.db2);
    	images.add(R.drawable.db3);
    	images.add(R.drawable.db4);
    	images.add(R.drawable.db5);
    	images.add(R.drawable.db6);
    	images.add(R.drawable.db7);
    	images.add(R.drawable.db8);
    	images.add(R.drawable.db9);
    	images.add(R.drawable.db10);
    	images.add(R.drawable.db11);
    	images.add(R.drawable.db12);
    	images.add(R.drawable.db13);
    	images.add(R.drawable.db14);
    	images.add(R.drawable.db15);
    	ImageAdapter adapter = new ImageAdapter(this, images);
    	gridView.setAdapter(adapter);
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.activity_grid_view_with_image_adapter_example, menu);
        return true;
    }
}
